'||[Creator]: DarKPaiN
'\\
'||[Mail]: DarKPaiN@England.com
'\\
'||[Copyright]: (C) DarKPaiN and Progenic Warfare (www.Progenic.com)
'\\
'||[Description]: This source code must be placed within a Bas file. This
'|| code will call the Process function in windows - and will allow the user
'|| to set their program as a system process - which will allow it to be INVISBLE
'|| in the task list (Ctrl-Alt-Del menu). It will also declare this program as
'|| a normal Process - reverting it back to it's normal state.
'\\
'||[Example]: (Place in a form and create 2 command buttons named cmdHidePro cmdShowPro
'\\
'|| Private Sub cmdHidePro_Click()
'||      SetService True
'||      msgbox "WoosH - I have disappeared from the task list..."
'|| End Sub
'||
'|| Private Sub cmdShowPro_Click()
'||      SetService False
'||      msgbox "WoosH - I have appeared in the task list..."
'|| End Sub
'================================\\/=======================================

Public Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Public Declare Function GetCurrentProcess Lib "kernel32" () As Long
Public Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID As Long, ByVal dwType As Long) As Long
Public Const Make_System_Process = 1
Public Const Make_Normal_Process = 0

Public Sub SetService(HideProcess As Boolean)
Dim Process_Code As Long, Return_Service As Long

If HideProcess Then
    Process_Code = GetCurrentProcessId()
    Return_Service = RegisterServiceProcess(pid, Make_System_Process)

ElseIf Not HideProcess Then
     Process_Code = GetCurrentProcessId()
     Return_Service = RegisterServiceProcess(pid, Make_Normal_Process)
     
End If
End Sub